package com.longxi.tianjintianbao.ui.adapter.multitype.equipment;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.model.equipment.EquipmentInspection;
import com.longxi.tianjintianbao.model.equipment.EquipmentMaintain;

import me.drakeet.multitype.ItemViewBinder;

/**
 * Created by cxw on 2018/2/20.
 */
public class EquipmentMaintainViewBinder extends ItemViewBinder<EquipmentMaintain, EquipmentMaintainViewBinder.ViewHolder> {

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View root = inflater.inflate(R.layout.item_equipment_maintain, parent, false);
        return new ViewHolder(root);
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull EquipmentMaintain equipmentMaintain) {
        holder.mTvInspectionno.setText("保养单号:" + equipmentMaintain.getMaintainno());
        holder.mTvUsername.setText("执行人员:" + equipmentMaintain.getExecutor());
        holder.mTvDate.setText("保养日期:" + equipmentMaintain.getMaintaindate());
        holder.mTvContent.setText(equipmentMaintain.getContent());
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        TextView mTvInspectionno;
        TextView mTvUsername;
        TextView mTvDate;
        TextView mTvContent;
        ViewHolder(View itemView) {
            super(itemView);
            mTvInspectionno = itemView.findViewById(R.id.tvInspectionno);
            mTvUsername = itemView.findViewById(R.id.tvUsername);
            mTvDate = itemView.findViewById(R.id.tvDate);
            mTvContent = itemView.findViewById(R.id.tvContent);
        }
    }
}
